import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { personnelaccessrecordsVO, personnelaccessrecordsForm, personnelaccessrecordsQuery } from '@/api/transitoverview/personnelAccessRecords/types';

/**
 * 查询人员通行记录列表
 * @param query
 * @returns {*}
 */

export const listpersonnelaccessrecords = (query?: personnelaccessrecordsQuery): AxiosPromise<personnelaccessrecordsVO[]> => {
  return request({
    url: '/transitoverview/personnelAccessRecords/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询人员通行记录详细
 * @param personnelAccessRecordsId
 */
export const getpersonnelaccessrecords = (personnelAccessRecordsId: string | number): AxiosPromise<personnelaccessrecordsVO> => {
  return request({
    url: '/transitoverview/personnelAccessRecords/' + personnelAccessRecordsId,
    method: 'get'
  });
};

/**
 * 新增人员通行记录
 * @param data
 */
export const addpersonnelaccessrecords = (data: personnelaccessrecordsForm) => {
  return request({
    url: '/transitoverview/personnelAccessRecords',
    method: 'post',
    data: data
  });
};

/**
 * 修改人员通行记录
 * @param data
 */
export const updatepersonnelaccessrecords = (data: personnelaccessrecordsForm) => {
  return request({
    url: '/transitoverview/personnelAccessRecords',
    method: 'put',
    data: data
  });
};

/**
 * 删除人员通行记录
 * @param personnelAccessRecordsId
 */
export const delpersonnelaccessrecords = (personnelAccessRecordsId: string | number | Array<string | number>) => {
  return request({
    url: '/transitoverview/personnelAccessRecords/' + personnelAccessRecordsId,
    method: 'delete'
  });
};
